package com.xuecheng.content.feignclient.auth;

import com.xuecheng.auth.model.po.XcTeacher;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class XcTeacherClientFactory implements FallbackFactory<XcTeacherClient> {
    @Override
    public XcTeacherClient create(Throwable throwable) {
        return new XcTeacherClient() {
            @Override
            public XcTeacher getTeacher(XcTeacher teacher) {
                log.error("调用用户认证管理服务-查询教师信息发生熔断:{}", throwable.toString(),throwable);
                return null;
            }

            @Override
            public XcTeacher saveTeacher(XcTeacher teacher) {
                log.error("调用用户认证管理服务-保存教师信息发生熔断:{}", throwable.toString(),throwable);
                return null;
            }
        };
    }
}
